package com.dbuil.bleshoes.ui.activity;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.dbuil.bleshoes.R;
import com.dbuil.bleshoes.base.BaseActivity;
import com.dbuil.bleshoes.utils.whiteutil.Battery;
import com.xuexiang.keeplive.KeepLive;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 白名单设置
 */
public class WhiteSetActivity extends BaseActivity {
    @BindView(R.id.tv_battery_status)
    TextView tvBatteryStatus;
    @BindView(R.id.tv_white_set)
    TextView tvWhiteSet;

    @Override
    public int getLayoutId() {
        return R.layout.activity_whiteset;
    }

    @Override
    public void initData() {
        super.initData();
        boolean b = Battery.addWhite(this);
        if (b) {
            tvBatteryStatus.setText("已开启");
        } else {
            tvBatteryStatus.setText("去开启");
        }
    }

    @OnClick({R.id.tv_battery_status, R.id.tv_white_set})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_battery_status:
                Battery.addWhite(this);
                break;
            case R.id.tv_white_set:
                //  new WhiteUtils(this).select();
//                Intent autostartSettingIntent = StartWhitesetUtils.getAutostartSettingIntent(this);
//                ActivityUtils.startActivity(autostartSettingIntent);
                KeepLive.gotoWhiteListActivity(this, "跑步功能");
                break;
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        boolean b = Battery.addWhite(this);
        if (b) {
            tvBatteryStatus.setText("已开启");
        } else {
            tvBatteryStatus.setText("去开启");
        }


    }
}
